package stack_queue.queue;

import java.util.ArrayDeque;
import java.util.Deque;

/**
 * @author yuisama
 * @date 2022/01/25 11:09
 **/
public class DequeTest {
    public static void main(String[] args) {
        // 基于数组实现的双端队列
        Deque<Integer> deque = new ArrayDeque<>();
        deque.addLast(1);
        deque.addLast(3);
        deque.addLast(5);
        // 尾插尾删或者头插头删就是栈
//        while (!deque.isEmpty()) {
//            System.out.println(deque.pollLast());
//        }
        // 头插尾删或者尾插头删就是队列
        while (!deque.isEmpty()) {
            System.out.println(deque.pollFirst());
        }
    }
}